//
//  ViewController.m
//  CPSecurityTools
//
//  Created by collegepre on 16/7/4.
//  Copyright © 2016年 collegepre. All rights reserved.
//

#import "ViewController.h"
#import "CPSecurityTools.h"
#import "DES3Util.h"
#import "GTMBase64.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *path = [[NSBundle mainBundle] pathForResource:@"1.jpg" ofType:nil];
    NSData *data =[[NSData alloc] initWithContentsOfFile:path];
    NSString *base64 = [GTMBase64 stringByEncodingData:data];
    
    NSString *decode = [DES3Util decryptUseDES:base64 key:@"izUUDLZu8kt+DWZ68LtExcIRoy/KPuKI"];
    NSLog(@"%@",decode);
    
    [[OpenSSLRSAWrapper shareInstance] encryptRSAKeyWithType:0 paddingType:1 data:[NSData data]];
}

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    NSUserDefaults *UserDef = [NSUserDefaults standardUserDefaults];
    NSString *URL =  [UserDef objectForKey:@"BaseURLPrefix"];
    NSLog(@"URL:%@",URL);
}

- (void)test{
   
}

- (void)filetest{
    NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"demo"];
    
    [[CPMediaDecryptTool defaultDecryptTool] decryptWithsuperFilePath:path headerLength:@"42" keyValue:@"111" progress:^(float progress) {
        NSLog(@"%f",progress);
    } complition:^(NSError *error) {
        NSLog(@"%@",error);
    }];
}

@end
